import {
  Http
} from "../http/http"

class LearnModel {
  // 课程
  static async courseList(type) {
    if (type) {
      return await Http.request({
        url: `system/course/list?courseType=${type}`,
        method: 'GET',
      })
    } else {
      return await Http.request({
        url: `system/course/list`,
        method: 'GET',
      })
    }

  }

  static async courseDetail(id) {
    return await Http.request({
      url: `system/course/app/${id}`,
      method: 'GET',
    })
  }
  // 资料
  static async dataList(type) {
    if(type) {
      return await Http.request({
        url: `system/data/list?dataType=${type}`,
        method: 'GET',
      })
    } else {
      return await Http.request({
        url: `system/data/list`,
        method: 'GET',
      })
    }
    
  }

  static async dataDetail(id) {
    return await Http.request({
      url: `system/data/app/${id}`,
      method: 'GET',
    })
  }

  // 试卷 
  static async paperList(data) {
    return await Http.request({
      url: `system/paper/app/list`,
      method: 'GET',
      data: data,
      // contentType: 'application/x-www-form-urlencoded'
    })
  }

  // 查询APP试卷问题列表
  static async paperDetail(id) {
    return await Http.request({
      url: `system/paper/app/${id}`,
      method: 'GET',
    })
  }

  // 添加用户答题记录
  static async postUserAnswer(data) {
    return await Http.request({
      url: `system/answer`,
      method: 'POST',
      data: data
    })
  }

}

export {
  LearnModel
}